import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { getModulesAll } from '/@/api/system/system';

export const columns: BasicColumn[] = [
  {
    title: '编码',
    dataIndex: 'code',
  },
  {
    title: '名称',
    dataIndex: 'name',
  },
  {
    title: '描述',
    dataIndex: 'desc',
  },
  {
    title: '类型',
    dataIndex: 'kind',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'code',
    label: '编码',
    component: 'Input',
    colProps: { span: 8 },
  },
  {
    field: 'name',
    label: '名称',
    component: 'Input',
    colProps: { span: 8 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'byModuleCode',
    label: '基准模块',
    required: true,
    component: 'ApiSelect',
    colProps: { span: 22 },
    componentProps: {
      api: getModulesAll,
      labelField: 'name',
      valueField: 'code',
      showSearch: true,
      optionFilterProp: 'label',
      getPopupContainer: () => document.body,
    },
  },
  {
    field: 'f',
    label: ' ',
    component: 'Input',
    colProps: { span: 22 },
    render: () => {
      return '注意：同步后权限将与所选择的基准模块一致)';
    },
  },
];
